Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLDR-16844 Show the Dashboard by default, and remember user preference #3934

Merged
merged 6 commits into from
Aug 5, 2024

Conversation

btangmu
Copy link
Member

@btangmu btangmu commented Aug 3, 2024

-New boolean dashWanted in cldrDashContext.mjs indicates whether the user wants the Dashboard open when appropriate

-New boolean method cldrDashContext.shouldBeShown takes into account dashWanted, and whether a Special page (other than GENERAL_SPECIAL) is open

-Add code to open the Dashboard (if shouldBeShown) where needed

-Encapsulate the string, general, as cldrLoad.GENERAL_SPECIAL

-Move message text to dash_needs_locale_and_coverage in cldrText.mjs, referenced in two places

-Fix bug: effectiveName called without locale arg; console.error if it happens again

-Remove confusing checkmark (vote.png) from General Info page; move style into GeneralInfo.vue

-Fix call to getClient, await is required

-Mark getClient as async to prevent VS Code wrongly warning that await is not needed

-Remove dead code

-Comments

CLDR-16844

  • This PR completes the ticket.

ALLOW_MANY_COMMITS=true

-New boolean dashWanted in cldrDashContext.mjs indicates whether the user wants the Dashboard open when appropriate

-New boolean method cldrDashContext.shouldBeShown takes into account dashWanted, and whether a Special page (other than GENERAL_SPECIAL) is open

-Add code to open the Dashboard (if shouldBeShown) where needed

-Encapsulate the string, general, as cldrLoad.GENERAL_SPECIAL

-Move message text to dash_needs_locale_and_coverage in cldrText.mjs, referenced in two places

-Fix bug: effectiveName called without locale arg; console.error if it happens again

-Remove confusing checkmark (vote.png) from General Info page; move style into GeneralInfo.vue

-Fix call to getClient, await is required

-Mark getClient as async to prevent VS Code wrongly warning that await is not needed

-Remove dead code

-Comments
@btangmu btangmu self-assigned this Aug 3, 2024
-New boolean dashWanted in cldrDashContext.mjs indicates whether the user wants the Dashboard open when appropriate

-New boolean method cldrDashContext.shouldBeShown takes into account dashWanted, and whether a Special page (other than GENERAL_SPECIAL) is open

-Add code to open the Dashboard (if shouldBeShown) where needed

-Encapsulate the string, general, as cldrLoad.GENERAL_SPECIAL

-Move message text to dash_needs_locale_and_coverage in cldrText.mjs, referenced in two places

-Fix bug: effectiveName called without locale arg; console.error if it happens again

-Remove confusing checkmark (vote.png) from General Info page; move style into GeneralInfo.vue

-Fix call to getClient, await is required

-Mark getClient as async to prevent VS Code wrongly warning that await is not needed

-Remove dead code

-Comments
@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@btangmu btangmu marked this pull request as ready for review August 4, 2024 16:02
@btangmu btangmu requested a review from srl295 August 4, 2024 16:02
*/
function getClient() {
async function getClient() {
return new SwaggerClient({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I changed this code to cache the client. Maybe it's stuck in some PR.

Looking at https://github.com/swagger-api/swagger-js/blob/master/docs/migration/migration-2-x-to-3-x.md#promises

I think the following is what we should be doing.

Suggested change
return new SwaggerClient({
return await SwaggerClient({

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test that locally...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the async nor await is not needed in that case actually. just pass return SwaggerClient as a Promise back to the callers who await it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say if the PR as is is working let's address this in a future one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, well... I just tested with changing new to await, and it worked, so I made a commit...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test return SwaggerClient and make that change if it works

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works

@@ -24,7 +26,7 @@ const specialToComponentMap = {
add_user: AddUser,
auto_import: AutoImport,
downgraded: DowngradedVotes,
general: GeneralInfo,
general: GeneralInfo, // see cldrLoad.GENERAL_SPECIAL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could integrate this better, but this is sufficient for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really all of these keys could benefit from encapsulation. I'm not sure what how/where, though... using cldrLoad.GENERAL_SPECIAL in place of general for the key isn't allowed in the initializer, but we could have initialization code like

specialToComponentMap[cldrLoad.GENERAL_SPECIAL] = GeneralInfo;

and likewise for the other keys...

Comment on lines 65 to 67
for (let i = 0; i < els.length; i++) {
els[i].style.display = "none";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this and not a reactive vue property?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was based on similar code in cldrDashContext.mjs. I can change it to a property...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to a property

srl295
srl295 previously approved these changes Aug 5, 2024
Copy link
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks OK, some suggestions for improvement which could be future.

-Revise getClient to use await SwaggerClient, per discussion in PR
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • tools/cldr-apps/js/src/esm/cldrClient.mjs is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

srl295
srl295 previously approved these changes Aug 5, 2024
-Revise getClient to use return SwaggerClient directly, per discussion in PR

-Use a v-if property for visibility of Open Dashboard button, no need for general-open-dash class
-Delete extraneous exclamation point
srl295
srl295 previously approved these changes Aug 5, 2024
-It was commented out, had uncommented-out for testing
>
Open Dashboard
</button>

<!-- <cldr-overall-errors /> -->
<cldr-overall-errors />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, did you mean to re-enable this? Why? I think we need to discuss first!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw it too just after the commit, sorry about the noise! It was temporary for testing the call to cldrClient that motivated the whole tangent

@btangmu btangmu requested a review from srl295 August 5, 2024 17:53
@btangmu btangmu merged commit ee6d64c into unicode-org:main Aug 5, 2024
13 checks passed
@btangmu btangmu deleted the t16844_f branch August 5, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants